/*
 * addon_dllutil.h
 *
 *  Created on: 2010-1-7
 *      Author: gavinkwoe
 */

#ifndef ADDON_HTTP_H_
#define ADDON_HTTP_H_

#include "addon_features.h"
#include "addon_std.h"
#include "addon_objbase.h"

#include "ExampleClientEngine.h"
/*************************************************************************
* INTERFACE
*************************************************************************/

ADDON_INTERFACE_( IAddonFile, 1, IObject )
{
	__INHERIT_FROM( IObject )

	ADDON_METHOD( Http_Create )	            ( ADDON_REF(IObject) thiz, IN const char * FileCookie,OUT void ** Client);
	ADDON_METHOD( Http_Close )	            ( ADDON_REF(IObject) thiz, IN void *Client);
	ADDON_METHOD( Http_SendRequest )		( ADDON_REF(IObject) thiz,IN void *Client,IN void *request,IN void *user);
	ADDON_METHOD( Http_CancleRequest )		( ADDON_REF(IObject) thiz,IN void *Client);
	ADDON_METHOD( RequestCreate )	        ( ADDON_REF(IObject) thiz, OUT void **request);
    ADDON_METHOD( RequestDestroy )	        ( ADDON_REF(IObject) thiz, IN void *request);
    ADDON_METHOD( RequestSetMethod )	    ( ADDON_REF(IObject) thiz, IN void *request,IN char *method);
    ADDON_METHOD( RequestSetResource )	    ( ADDON_REF(IObject) thiz, IN  void *request,IN  char *resource);
    ADDON_METHOD( RequestSetVersion )	    ( ADDON_REF(IObject) thiz, IN void *request,IN char *HttpVersion);
    ADDON_METHOD( RequestSetHost )	        ( ADDON_REF(IObject) thiz, IN void *request,IN char *Host);
    ADDON_METHOD( RequestSetXOnLineHost )	( ADDON_REF(IObject) thiz, IN void *request,IN char *OnLineHost);
    ADDON_METHOD( RequestSetConnection )	( ADDON_REF(IObject) thiz, IN void *request,IN char *Connection);
    ADDON_METHOD( RequestSetKeepAlive )	    ( ADDON_REF(IObject) thiz, IN void *request,IN char *KeepAlive);
    ADDON_METHOD( RequestSetUserAgent )	    ( ADDON_REF(IObject) thiz, IN void *request,IN char *UserAgent);
    ADDON_METHOD( RequestSetQUA )	        ( ADDON_REF(IObject) thiz, IN void *request,IN char *QUA);
    ADDON_METHOD( RequestSetAcceptLanguage) ( ADDON_REF(IObject) thiz, IN void *request,IN char *AcceptLanguage);
    ADDON_METHOD( RequestSetAccept )	    ( ADDON_REF(IObject) thiz, IN void *request,IN char *Accept);
    ADDON_METHOD( RequestSetContentType )	( ADDON_REF(IObject) thiz, IN void *request,IN char *ContentType);
    ADDON_METHOD( RequestSetContentLength)  ( ADDON_REF(IObject) thiz, IN void *request,IN char *ContentLength);
    ADDON_METHOD( RequestSetIfModifySince)  ( ADDON_REF(IObject) thiz, IN void *request,IN char *pIfModifySince);
    ADDON_METHOD( RequestSetRefer)          ( ADDON_REF(IObject) thiz, IN void *request,IN char *Refer);
    ADDON_METHOD( RequestSetPostData)       ( ADDON_REF(IObject) thiz, IN void *request,IN void *data,IN unsigned long datasize);
    ADDON_METHOD( RequestSetRange)          ( ADDON_REF(IObject) thiz, IN void *request,IN int start,IN int size);
    ADDON_METHOD( RequestSetAcceptEncode)   ( ADDON_REF(IObject) thiz, IN void *request, IN char* AcceptEncode);
    ADDON_METHOD( RequestSetAcceptCharSet)  ( ADDON_REF(IObject) thiz, IN void *request, IN char* AcceptCharSet);
};

/*************************************************************************
* DECLARATION
*************************************************************************/

#if defined(__cplusplus)
extern "C" {
#endif	// #if defined(__cplusplus)
	
ADDON_IMPORT ADDON_REF(IObject)	addon_create_file( void * reserved );

#if defined(__cplusplus)
};
#endif	// #if defined(__cplusplus)

/*************************************************************************
* MACRO
*************************************************************************/

#define IAddonFile_VTBL( p )			ADDON_GET_VTBL_(p, IAddonFile)
#define IAddonFile_CALL( p, a )			IAddonFile_VTBL(p)->a
#define IAddonFile_HasOpen( p, a )		IAddonFile_CALL( p, HasOpen )( p, a )
#define IAddonFile_Open( p, a )			IAddonFile_CALL( p, Open )( p, a )
#define IAddonFile_Close( p )			IAddonFile_CALL( p, Close )( p )
#define IAddonFile_GetSize( p, a )		IAddonFile_CALL( p, GetSize )( p, a )
#define IAddonFile_GetOffset( p, a )	IAddonFile_CALL( p, GetOffset )( p, a )
#define IAddonFile_Seek( p, a )			IAddonFile_CALL( p, Seek )( p, a )
#define IAddonFile_Read( p, a, b, c )	IAddonFile_CALL( p, Read )( p, a, b, c )

#endif /* ADDON_FILE_H_ */
